<template>
  <el-form
      style="max-width: 600px"
      :model="user"
      label-width="auto"
      class="demo-ruleForm"
      :size="formSize"
      status-icon
  >
    <el-form-item label="ID">
      <el-input v-model="user.id" disabled/>
    </el-form-item>
    <el-form-item label="账号">
      <el-input v-model="user.loginAct" disabled/>
    </el-form-item>
    <el-form-item label="手机">
      <el-input v-model="user.phone" disabled/>
    </el-form-item>

    <el-form-item label="姓名">
      <el-input v-model="user.name" disabled/>
    </el-form-item>

    <el-form-item label="邮箱">
      <el-input v-model="user.email" disabled/>
    </el-form-item>

    <el-form-item label="账号未过期">
      <el-input :model-value="user.accountNoExpired == 1 ? '是':'否'" disabled/>
    </el-form-item>

    <el-form-item label="密码未过期">
      <el-input :model-value="user.credentialsNoExpired == 1 ? '是':'否'" disabled/>
    </el-form-item>

    <el-form-item label="账号未锁定">
      <el-input :model-value="user.accountNoLocked == 1 ? '是':'否'" disabled/>
    </el-form-item>

    <el-form-item label="账号是否启用">
      <el-input :model-value="user.enabled == 1 ? '是':'否'" disabled/>
    </el-form-item>

    <el-form-item label="创建时间">
      <el-input v-model="user.createTime" disabled/>
    </el-form-item>

    <el-form-item label="创建人">
      <el-input v-model="user.createPo.name" disabled/>
    </el-form-item>

    <el-form-item label="编辑时间">
      <el-input v-model="user.editTime" disabled/>
    </el-form-item>

    <el-form-item label="编辑人">
      <el-input v-model="user.editPo.name" disabled/>
    </el-form-item>

    <el-form-item label="最近登录时间">
      <el-input v-model="user.lastLoginTime" disabled/>
    </el-form-item>

    <el-form-item>
      <el-button type="success" size="large"  @click="goBack">点击返回</el-button>
    </el-form-item>

  </el-form>
</template>

<script >
import {doGet} from "@/http/httpRequest";
import {goBack} from "@/util/utils";

export default {
  name:"UserDetailView",
  data(){
    return{
      user: {
        "createPo" :{},
        "editPo" :{},

      },
    }
  },
  methods:{
    userDetail(id) {
      doGet("api/userDetail/" + id, {}).then(res =>{
        if (res.data.code === 200) {
          this.user = res.data.data;
        }
      })
    },
    //声明外部调用的方法
    goBack,
  },
  mounted() {
    this.userDetail(this.$route.params.id)
  }
}
</script>

<style scoped>
.edit{
  margin-bottom: 15px;
}
</style>